package com.example.glide_sdk

import android.content.Context
import android.graphics.Bitmap
import android.widget.ImageView
import com.bumptech.glide.Glide

class ImgLoad {

    companion object{
        fun loadMatchImg(url: String?, imageView: ImageView) {
            Glide.with(imageView.context)
                .load(url)
                .placeholder(R.drawable.icon8)
                .error(R.drawable.icon8)
                .into(imageView)
        }
        fun loadResImg(resId : Int,imageView: ImageView){
            Glide.with(imageView).load(resId)
                .placeholder(R.drawable.icon8)
                .error(R.drawable.icon8)
                .into(imageView)
        }
        fun loadThumbnail(thumbnailUrl: String?, srcUrl: String?, imageView: ImageView) {
            Glide.with(imageView.context)
                .load(srcUrl)
                .thumbnail(
                    Glide.with(imageView.context)
                        .load(thumbnailUrl)
                ).into(imageView)
        }

        fun loadCirImg(url: String?, imageView: ImageView) {
            Glide.with(imageView.context)
                .load(url)
                .placeholder(R.mipmap.ic_launcher)
                .circleCrop()
                .error(R.mipmap.ic_launcher)
                .into(imageView)
        }

    }
}